<script>
import { useUserStore } from '@/store/user';
import storage from '@/utils/storage';

export default {
  onLaunch: function () {
		// TODO 401的login，重复
		const { login } = useUserStore()
		login()
		
		const lastPage = storage().get('lastPagePath')
		if (lastPage && lastPage?.route) {
		  const params = lastPage.options || {}
		  const query = Object.keys(params).map(key => 
			`${key}=${params[key]}`
		  ).join('&')
		  const url = `/${lastPage.route}${query ? `?${query}` : ''}`
		  storage().remove('lastPagePath')
		  
		  uni.reLaunch({ url })
		}
  },
  onShow: function () {
	  
  },
  onHide: function () {
	  
  },
}
</script>

<style lang="scss">
/*每个页面公共css */
@import "style/basics.scss";
@import "style/global.scss";
@import "style/public.scss";
@import "nutui-uniapp/styles/index.scss";
</style>
